package cn.kgc.controller;

import cn.kgc.pojo.Dept;
import cn.kgc.service.DeptFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Rock
 * @create 2020-07-11 11:09
 */
@RestController
@Slf4j
public class DeptConsumerController {

    @Autowired
    private DeptFeignService deptFeignService;

    @RequestMapping("/consumer/dept/add")
    public Boolean add(Dept dept){
        return deptFeignService.addDept(dept);
    }

    @RequestMapping("/consumer/dept/get/{id}")
    public Dept get(@PathVariable("id") Integer id){
        return deptFeignService.queryById(id);
    }

    @RequestMapping("/consumer/dept/list")
    public List<Dept> list(){
        return deptFeignService.queryAll();
    }
}
